import StringUtil from '@/utils/string.js';

/**
 * 获取文件名称
 *
 * @param data 资源数据
 * @returns {*|string}
 */
export function getName(data) {
  const { resourceType } = data;
  if (resourceType === 'file') {
    return StringUtil.isNotEmpty(data?.fileExtension)
      ? `${data?.resourceName}.${data?.fileExtension}`
      : `${data?.resourceName}`;
  } else if (resourceType === 'directory') {
    return data?.resourceName;
  }
}
